import moment from 'moment';
import { CONCLUSION_STATUS_VALUES, TALK } from '../constants';

const def = '-';
// 总结结论选项
export const generateSummaryConclusionOption = interviewType => {
    let ret;
    if (interviewType === TALK.AHEAD_FORMAL) {
        ret = [CONCLUSION_STATUS_VALUES.EARLY, CONCLUSION_STATUS_VALUES.CONTINUED];
    } else if (interviewType === TALK.FORMAL) {
        ret = [
            CONCLUSION_STATUS_VALUES.ALLOWABLE,
            CONCLUSION_STATUS_VALUES.CONTINUED,
            CONCLUSION_STATUS_VALUES.TERMINATE
        ];
    } else {
        ret = [CONCLUSION_STATUS_VALUES.CONTINUED, CONCLUSION_STATUS_VALUES.TERMINATE];
    }
    return ret;
};

// 面试记录结论选项
export const generateRecordConclusionOption = interviewType => {
    let ret;
    if (interviewType === TALK.AHEAD_FORMAL) {
        ret = [CONCLUSION_STATUS_VALUES.EARLY, CONCLUSION_STATUS_VALUES.CONTINUED];
    } else if (interviewType === TALK.FORMAL) {
        ret = [
            CONCLUSION_STATUS_VALUES.ALLOWABLE,
            CONCLUSION_STATUS_VALUES.CONTINUED,
            CONCLUSION_STATUS_VALUES.INSPECT,
            CONCLUSION_STATUS_VALUES.TERMINATE
        ];
    } else {
        ret = [
            CONCLUSION_STATUS_VALUES.CONTINUED,
            CONCLUSION_STATUS_VALUES.INSPECT,
            CONCLUSION_STATUS_VALUES.TERMINATE
        ];
    }
    return ret;
};

const dataFormat = source => moment(source).format('YYYY/MM/DD');
// 面谈准备 提示消息
export const generatePrepareAlertMessage = (employeeName = def, label, target, suffix) => {
    const { periodStart = def, interviewResultTypeName = def } = target ?? {};
    const message = `新员工 ${employeeName} ${label} (${dataFormat(
        periodStart
    )}) 为“${interviewResultTypeName}”，${suffix}`;
    return message;
};
